package thu.cs.segroup.agent.behaviour;

import java.util.ArrayList;

import thu.cs.segroup.entity.TestResult;
import thu.cs.segroup.util.Constants;
import thu.cs.segroup.agent.Runner;

import jade.core.Agent;
import jade.core.behaviours.OneShotBehaviour;
import jade.lang.acl.ACLMessage;

public class RunnerReturnResultBehav extends OneShotBehaviour{

	public RunnerReturnResultBehav(Agent agent) {
		super(agent);
	}
	
	@Override
	public void action() {
		Runner runner = (Runner)myAgent;
		TestResult result = new TestResult();
		result.setRunner(myAgent.getLocalName());
		result.setTask_name(runner.getTask().getName());
		
		ArrayList<String> des = new ArrayList<String>();
		des.add(runner.getCoor());
		runner.addBehaviour(new CommonSendObjMsgBehav(result, des, Constants.RESULT_ARRIVE, ACLMessage.INFORM,
					myAgent));
		
	}

}
